package com.future.future.movie.controller;

import java.util.Arrays;
import java.util.Map;

import com.future.future.commons.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.future.future.movie.entity.AwardsEntity;
import com.future.future.movie.service.AwardsService;

import com.future.future.commons.utils.R;



/**
 * 奖项表
 *
 * @author sn
 * @email sn@gmail.com
 * @date 2021-01-18 17:15:03
 */
@RestController
@RequestMapping("movie/awards")
public class AwardsController {

    @Autowired
    private AwardsService awardsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = awardsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{awardsId}")
    public R info(@PathVariable("awardsId") Long awardsId){
		AwardsEntity awards = awardsService.getById(awardsId);

        return R.ok().put("awards", awards);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AwardsEntity awards){
		awardsService.save(awards);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AwardsEntity awards){
		awardsService.updateById(awards);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] awardsIds){
		awardsService.removeByIds(Arrays.asList(awardsIds));

        return R.ok();
    }

}
